#

| Chapter 9 Saving Time on the Command Line |

## 9.2 Fix a Line Faster with Line-Kill and Word-Erase

It's amazing how often you'll see even moderately experienced UNIX users holding down the BACKSPACE or DELETE key to delete a partially completed command line that contains an error.

It's usually easier to use the line-kill character - typically CTRL-u or CTRL-x. (The command stty -a or stty everything (41.3) will tell you which. Article 5.9 shows how to change them.) The line-kill character will work on a command line (at a shell prompt (7.1)) and in other places where the terminal is in cooked mode (41.2). Some UNIX programs that don't run in cooked mode, like vi, understand the line-kill character, too.

Even better, many systems have a "word-erase" character, usually CTRL-w, which deletes only back to the previous whitespace. There's no need to delete the entire command line if you want to change only part of it!

On some systems with command-line editing (11.13), though, the line-kill and word-erase characters may not work the way we've explained. That's because the command-line editing isn't done in cooked mode; the shell handles every character you type. Check your shell's manual page.

- JP, TOR

9.1 What's Special About the UNIX Command Line |  | 9.3 Reprinting Your Command Line with CTRL-r